<?php

/**
 * SocialEnginePro
 *
 * @category   Application_Extensions
 * @package    tv
 * @author     Azim
 */

/**
 * @category   Application_Extensions
 * @package    tv
 */
class Tv_Widget_SimilarTvController extends Engine_Content_Widget_Abstract {

    public function indexAction() {
        if (!Engine_Api::_()->core()->hasSubject()) {
            return $this->setNoRender();
        }
        $subject = Engine_Api::_()->core()->getSubject('tv');


        $this->view->paginator = $paginator = Zend_Paginator::factory($subject->getSimilarTv());

        // Set item count per page and current page number
        $paginator->setItemCountPerPage($this->_getParam('itemCountPerPage', 2));
        $paginator->setCurrentPageNumber($this->_getParam('page', 1));

        if ($paginator->getTotalItemCount() <= 0) {
            return $this->setNoRender();
        }
    }

}